package com.wondedDream.util;

import cn.hutool.crypto.symmetric.AES;
import java.util.Base64;

public class DecryptUtils {
    public static String decryptPhoneNumber(String sessionKey, String encryptedData, String iv) {
        byte[] sessionKeyBytes = Base64.getDecoder().decode(sessionKey);
        byte[] encryptedDataBytes = Base64.getDecoder().decode(encryptedData);
        byte[] ivBytes = Base64.getDecoder().decode(iv);
        AES aes = new AES("CBC", "PKCS7Padding", sessionKeyBytes, ivBytes);
        byte[] resultBytes = aes.decrypt(encryptedDataBytes);
        return new String(resultBytes);
    }
}